package com.ruoyi.neusoft.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.neusoft.domain.AiIdentifyVideoUploadT;
import com.ruoyi.neusoft.service.IAiIdentifyVideoUploadTService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 算法模型-视频管理Controller
 * 
 * @author AI
 * @date 2023-12-06
 */
@Controller
@RequestMapping("/AI/VideoUploadService")
public class AiIdentifyVideoUploadTController extends BaseController
{
    private String prefix = "AI/VideoUploadService";

    @Autowired
    private IAiIdentifyVideoUploadTService aiIdentifyVideoUploadTService;

    @RequiresPermissions("AI:VideoUploadService:view")
    @GetMapping()
    public String VideoUploadService()
    {
        return prefix + "/VideoUploadService";
    }

    /**
     * 查询算法模型-视频管理列表
     */
    @RequiresPermissions("AI:VideoUploadService:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AiIdentifyVideoUploadT aiIdentifyVideoUploadT)
    {
        startPage();
        List<AiIdentifyVideoUploadT> list = aiIdentifyVideoUploadTService.selectAiIdentifyVideoUploadTList(aiIdentifyVideoUploadT);
        return getDataTable(list);
    }

    /**
     * 导出算法模型-视频管理列表
     */
    @RequiresPermissions("AI:VideoUploadService:export")
    @Log(title = "算法模型-视频管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AiIdentifyVideoUploadT aiIdentifyVideoUploadT)
    {
        List<AiIdentifyVideoUploadT> list = aiIdentifyVideoUploadTService.selectAiIdentifyVideoUploadTList(aiIdentifyVideoUploadT);
        ExcelUtil<AiIdentifyVideoUploadT> util = new ExcelUtil<AiIdentifyVideoUploadT>(AiIdentifyVideoUploadT.class);
        return util.exportExcel(list, "算法模型-视频管理数据");
    }

    /**
     * 新增算法模型-视频管理
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存算法模型-视频管理
     */
    @RequiresPermissions("AI:VideoUploadService:add")
    @Log(title = "算法模型-视频管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AiIdentifyVideoUploadT aiIdentifyVideoUploadT)
    {
        return toAjax(aiIdentifyVideoUploadTService.insertAiIdentifyVideoUploadT(aiIdentifyVideoUploadT));
    }

    /**
     * 修改算法模型-视频管理
     */
    @RequiresPermissions("AI:VideoUploadService:edit")
    @GetMapping("/edit/{videoId}")
    public String edit(@PathVariable("videoId") Long videoId, ModelMap mmap)
    {
        AiIdentifyVideoUploadT aiIdentifyVideoUploadT = aiIdentifyVideoUploadTService.selectAiIdentifyVideoUploadTByVideoId(videoId);
        mmap.put("aiIdentifyVideoUploadT", aiIdentifyVideoUploadT);
        return prefix + "/edit";
    }

    /**
     * 修改保存算法模型-视频管理
     */
    @RequiresPermissions("AI:VideoUploadService:edit")
    @Log(title = "算法模型-视频管理", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AiIdentifyVideoUploadT aiIdentifyVideoUploadT)
    {
        return toAjax(aiIdentifyVideoUploadTService.updateAiIdentifyVideoUploadT(aiIdentifyVideoUploadT));
    }

    /**
     * 删除算法模型-视频管理
     */
    @RequiresPermissions("AI:VideoUploadService:remove")
    @Log(title = "算法模型-视频管理", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(aiIdentifyVideoUploadTService.deleteAiIdentifyVideoUploadTByVideoIds(ids));
    }
}
